var EXPORTED_SYMBOLS = ["DMS_SendEmuleLink"];

DMS_SendLink = function(){

};

Components.utils.import("resource://SynoLoader/Command.js");  
Components.utils.import("resource://SynoLoader/Util.js");  
Components.utils.import("resource://SynoLoader/DMS_Commando/DMS_Connect.js"); 
Components.utils.import("resource://SynoLoader/Notification.js"); 

DMS_SendEmuleLink = new Command();
DMS_SendEmuleLink.constructor = DMS_SendEmuleLink;
DMS_SendEmuleLink.link="";
DMS_SendEmuleLink.downloadfolder="";


DMS_SendEmuleLink.onsuccess	= function(http_request)
{
  	var mpInfo = JSON.parse(http_request.responseText); 
	if (mpInfo.success == false)
	{
		Util.log("Send Emule Link Faild!\n" + mpInfo.errno.section +" : " +mpInfo.errno.key);  
		DMS_Connect.send();
	}
	else    
	{
		Util.log("Send Emule Link: "+this.link);
		Notification.show("Send Emule Link", this.link);
		Notification.showDownlaodManager();
	}	
};  

 
DMS_SendEmuleLink.setParameter= function(link)
{
	this.link=link;
	this.parameter='action=add_one_link&field=NAME&direction=ASC&limit=100&destination=' + encodeURIComponent(this.downloadfolder) + '&upload_type=url&link=' + encodeURIComponent(link);
};



